import {request} from '@umijs/max';
import * as API from "@/services";


/** 期刊 分页检索请求 */
export async function queryJournals(params?: API.JournalPageQueryParams): Promise<API.RespPageResult<API.Journal>> {
  return request('/api/v1/journal', {
    params,
  });
}

/** 期刊 详情请求 */
export async function queryJournal(bizId: API.EntityId): Promise<API.RespResult<API.Journal>> {
  return request(`/api/v1/journal/${bizId}`);
}

/** 期刊 创建请求 */
export async function createJournal(entity: API.Journal_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal`, {
    method: 'POST',
    data: entity,
  });
}

/** 期刊 修改请求 */
export async function modifyJournal(entity: API.Journal_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 期刊 修改(部分)请求 */
export async function patchJournal(entity: API.Journal_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 期刊 删除请求 */
export async function deleteJournal(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal/${bizId}`, {
    method: 'DELETE',
  });
}

/** 期刊 批量删除请求 */
export async function deleteJournals(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}
